package servlet;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import db.DBManager;

public class login extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response) {
		Connection cn;
		try {
			cn = DBManager.getConnection();
			Statement stat = cn.createStatement();
			ResultSet rset = stat.executeQuery("select * from account");
			int numcols = rset.getMetaData().getColumnCount();
	        while(rset.next()) {
	            for(int i=1;i<=numcols;i++) {
	                System.out.print("\t" + rset.getString(i));
	            }
	            System.out.println("");
	        }
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	public void doPost(HttpServletRequest request, HttpServletResponse response) {
		doGet(request, response);
	}
}
